<template>
  <div class="child1">
    <h3>子组件1</h3>
		<h4>toy: {{ toy }}</h4>
		<h4>Book: {{ book }}</h4>
		<button @click="minusHouse($parent)">get a house from parent</button>
  </div>
</template>

<script setup lang="ts" name="Child1">
	import { ref } from "vue";

	// 数据
	let toy = ref('aoteman')
	let book = ref(3)

	function minusHouse(parent:any) {
		parent.house -= 1;
	}

	// 数据交给外部
	defineExpose({toy, book})
</script>

<style scoped>
	.child1{
		margin-top: 20px;
		background-color: skyblue;
		padding: 20px;
		border-radius: 10px;
    box-shadow: 0 0 10px black;
	}
</style>
